<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/17/0017
 * Time: 16:31
 */

namespace app\sports_admin\controller;


use think\Request;
use app\sports_admin\model\SchoolLoginLog as SchoolLoginLogModel;
class SchoolLoginLog extends Base
{
    protected $beforeActionList = [
        'isData'=>['only'=>'index,getschoolloginloginfo'],
        'operationSelect'=>['only'=>'index,getschoolloginloginfo']
    ];
    //记录首页
    public function index()
    {
        return view('index');
    }

    /**
     * 获取学校登录日志
     * @param $page 第几页
     * @param $rows 每页显示的条数
     * @param $sort 要排序的字段
     * @param $sortOrder 升序/降序
     * @param $searchName 要检索的字段
     * @param $start 检索的开始时间
     * @param $end 检索的结束时间
     */
    public function getSchoolLoginLogInfo()
    {
        $params = Request::instance()->only(['page','rows','sort','sortOrder','searchName','start','end']);
        $page = intval($params['page']) ? intval($params['page']) : 1;
        $rows = intval($params['rows']) ? intval($params['rows']) : 15;
        $sort = trim($params['sort']) ? trim($params['sort']) : 'id';
        $sortOrder = trim($params['sortOrder']) ? trim($params['sortOrder']) : 'asc';
        $searchName = trim($params['searchName']);
        $start = trim($params['start']);
        $end = trim($params['end']);
        return SchoolLoginLogModel::getSchoolLoginLogInfo($page,$rows,$sort,$sortOrder,$searchName,$start,$end);
    }
}